Skip to content

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Jul 19, 2025

Note: This is mostly an experiment, I'm not sure I want to really merge it right about now.

What's the problem this PR addresses?

I'm playing with porting the nm hoister, and the tree data structure can make things impractical. I'm also interested into avoiding recursive data structures to make the memory access faster.

How did you fix it?

This diff attempts to "flatten" the tree by turning recursive data structures into a flat array we reference through cell indices. So for example instead of:

interface Node {
  children: Array<Node>;
}

We instead have:

interface Node {
  children: Array<number>;
}

interface Tree {
  nodes: Array<Node>;
  root: number;
}

It makes some things harder, but other things slightly easier.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant